/*
 * OracleConnectionFactory.java
 *
 * Created on 29 de Maio de 2009, 13:39
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package sisnutri;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

/**
 *
 * @author bruno
 */
public class OracleConnectionFactory {
    
    private static Connection con;
    
    /** Creates a new instance of OracleConnectionFactory */
    private OracleConnectionFactory() {
        
    }
    
    public static Connection getConnection(){
        if(con==null){

            try {
                Class.forName("oracle.jdbc.driver.OracleDriver");
                con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521", "system", "foucault");
            } catch (SQLException ex) {
                ex.printStackTrace();
            } catch (ClassNotFoundException ex) {
                ex.printStackTrace();
            }
        }
        return con;
    }
}
